<template>
  <div style="height: 1000px">
    <el-table title="在线用户" :data="tableData">
      <el-table-column prop="account" label="账号" />
      <el-table-column prop="name" label="姓名" />
    </el-table>
  </div>
</template>

<script>
import { EventBus } from "@/utils/eventBus";
import { getOnLineCount } from "@/api/user";

export default {
  data() {
    return {
      tableData: [],
    };
  },
  computed: {},
  methods: {},
  created() {
    getOnLineCount().then((res) => {
      this.tableData = res.data;
    });
  },
  beforeDestroy() {
    EventBus.$off("refleshList"); // 清理监听器
  },
};
</script>

<style lang="scss" scoped>
.dashboard-text {
  margin-top: 20px;
}
</style>
